 <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台管理系统</title>
<meta name="keywords" content="">
<meta name="description" content="">
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="css/ie6.css"/>
<![endif]-->
<link rel="stylesheet" type="text/css"  href="../../../../public/layui/css/layui.css">
<link href="../../../../public/admin/css/style_v2.0.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/style_v2.0.css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
</head>
<body>
<div class="position mt10">当前位置：<a href="{:U('Index/main')}">后台首页</a>  > <a href="{:U('Finance/renewal')}">续费统计</a>  >  全部续费 </div>
<div id="container">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>全部续费</legend>
</fieldset>
<div class="layui-form">
    <div class="layui-btn-group">
         <a href="{:U('Finance/renewal')}" class="layui-btn layui-btn-big"><i class="layui-icon">&#xe60a;</i>全部续费</a>&nbsp;
         <button class="layui-btn layui-btn-big"  data-method="notice" ><i class="layui-icon">&#xe654;</i> 新增续费</button>&nbsp;
         <a href="{:U('Finance/export_renewal/')}"  class="layui-btn layui-btn-big layui-btn-normal"><i class="layui-icon">&#xe62d;</i> 导出报表</a>&nbsp;
         <button class="layui-btn layui-btn-big"  data-method="imports" ><i class="layui-icon">&#xe654;</i> 导入Excel</button>&nbsp;
    </div>
    <div class="hselect mt10" style="background-color:#FFFFFF;">
    <form name='search' action="{:U('Admin/Finance/renewal',array('so' => 'search'))}" enctype="multipart/form-data" method="get"  class="layui-form">
    <span>高级搜索：</span>
    <div id="keyword"><input name="keyword" type="text" id="keyword"  value="" placeholder="请输入关键词" autocomplete="off" class="layui-input"></div>
    
    <span>支付方式:</span>
    <div class="hselect_box" style="width:120px;">
     <select name="payway" lay-verify="">
           <option value="">支付方式</option>
           <foreach name="pay"  item="item" id="index">
           <option value="{$item}">{$item}</option>
           </foreach>
        </select>
    </div>
    <span>日期:</span>
    <div class="hselect_box" style="width:120px;">
         <input name="start" type="text" value=""  placeholder="开始日" class="layui-input ico-date" id="start">
    </div>
    <span style="padding-right:10px">-</span>
    <div class="hselect_box" style="width:120px;">
    <input name="end" type="text"  value=""  placeholder="结束日"  class="layui-input ico-date" id="end">
    </div>
    <div class="hselect_box"><button class="layui-btn layui-btn-primary" style=" margin-top:-4px;" lay-submit lay-filter="formSearch" id="search">立即提交</button></div>
    </form>
    <div class="c"></div>
</div>
</div>
<!--高级搜索-->
<div class="c"></div>
<div class="layui-form" style="background-color:#FFFFFF;">
<table class="layui-table" id="table">
    <thead>
    <tr style="text-align:center;">
      <th style="text-align:center;"></th>
      <th style="text-align:center;">编号</th>
      <th style="text-align:center;">网站名称</th>
      <th style="text-align:center;">网站域名</th>
      <th style="text-align:center;">续费金额</th>
      <th style="text-align:center;">续费方式</th>
      <th style="text-align:center;">续费时间</th>
      <th style="text-align:center;">联系人</th>
      <th style="text-align:center;">备注</th>
      <th colspan="2" style="text-align:center;">操作</th>
    </tr> 
    </thead>
    <form id="form2" name="form2" method="post" action="{:U('Admin/Finance/renewal_del/')}">  
     <volist name="list" id="r">
    <tr>
      <td  align="center" class="layui-form-item"><input type="checkbox" id="rid[]" title=""  lay-skin="primary"  name="rid[]" value="{$r.rid}"/></td>
      <td align="center">{$r.rid}</td>
      <td align="center" height="22px">{$r.webname}</td>
      <td align="center" height="22px">{$r.weburl}</td>
      <td  align="center" id="income">{$r.num}</td>
      <td  align="center">{$r.payway}</td>
      <td  align="center" >{$r.paytime|date='Y-m-d',###}</td>
      <td  align="center">{$r.linkman}</td>
      <td  align="center" >{$r.content}</td>
      <td  align="center">
          <div class="layui-btn-group">
          <a href="{:U('Admin/Finance/renewal_edit/',array('rid' => $r['rid']))}" title="编辑" class="layui-btn layui-btn-small"><i class="layui-icon">&#xe642;</i></a><a href="{:U('Admin/Finance/renewal_del',array('rid' => $r['rid']))}" class="layui-btn layui-btn-small layui-btn-danger" title="删除" onClick="return checkConfirm('您确认删除记录?')"><i class="layui-icon">&#xe640;</i></a>          </div>      </td>
    </tr>
    </volist>
    <tr>
      <td  align="center" class="layui-form-item">&nbsp;</td>
      <td align="center">&nbsp;</td>
      <td align="center" height="22px">&nbsp;</td>
      <td align="center" height="22px">本页续费总和：</td>
      <td  align="center" id="income2">&nbsp;</td>
      <td  align="center">&nbsp;</td>
      <td  align="center" >&nbsp;</td>
      <td  align="center">&nbsp;</td>
      <td  align="center" >&nbsp;</td>
      <td  align="center">&nbsp;</td>
    </tr>
    <tr>
      <td align="center"><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></td>
      <td colspan="14">
      <div style="padding-left:20px;">  
         <input type="button" value="全选" name="selectall" class="layui-btn" />
         <input type="button" value="反选" name="selectno" class="layui-btn "/>
         <button  name="btnDel" lay-submit="" lay-filter="btnDel" class="layui-btn layui-btn-danger" />删除</button>
      </div>      </td>
    </tr>
   </form>
    </table>
    <div class="c"></div>
    <div id="pages">{$page}</div>      
</div>
</div>
</body>
</html>
<form name=reg action="{:U('Admin/Finance/renewal_update')}"  enctype="multipart/form-data"  method="post"  class="layui-form" id="renewal_add" style="display:none;">
<div class="layui-form">
    <table class="layui-table">
    <tr>
	  <td width="20%" align="right">网站名称：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="webname" type="text" id="webname" value="" required  lay-verify="" placeholder="网站名称" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right">网站域名：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="weburl" type="text" id="weburl" value="" required  lay-verify="" placeholder="网站域名" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right">续费金额：</td>
	  <td width="80%">
      <span class="table_span" style="width:100px; float:left;">
          <input name="num" type="text" id="num" value=""  lay-verify="" placeholder="￥" autocomplete="off" class="layui-input">
      </span>
      <span class="table_txt">支付方式</span>
      <span class="table_span" style="width:115px; float:left;">
           <select name="payway" lay-verify="">
           <option value="">支付方式</option>
           <foreach name="pay"  item="item" id="index">
           <option value="{$item}">{$item}</option>
           </foreach>
        </select>
      </span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>打款时间：</td>
	  <td width="80%">
      <span class="table_span" style="width:200px; float:left;"><input name="paytime" type="text" id="paytime" value="" required  lay-verify="" placeholder="打款时间" autocomplete="off" class="layui-input ico-date"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right">联系人：</td>
	  <td width="80%">
      <span class="table_span" style="width:200px; float:left;">
      <input name="linkman" type="text" id="linkman" value=""  lay-verify="" placeholder="联系人" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
     <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>备注：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><textarea name="content" type="text" id="content" value=""  lay-verify="" placeholder="备注" autocomplete="off" class="layui-textarea" style="height:60px;"></textarea></span>
      </td>
    </tr>
    <tr>
	  <td align="right"><font color=red size="1">·</font>添加时间：</td>
	  <td><span class="table_span" style="width:200px; float:left;"><input name="inputtime" type="text" id="inputtime" value="{$now|date='Y-m-d H:i:s',###}"  autocomplete="off" class="layui-input ico-date" ></span></td>
	  </tr>
    <tr> 
	  <td colspan=2 align="center" valign="middle">
		<input type="submit" name="Submit" value="确&nbsp; &nbsp;定" class="layui-btn" >
		<input type="reset" name="Submit2" value="重　置" class="layui-btn layui-btn-primary" >		 </td>
	</tr>
    </table>
</div>
</form>
<form name=reg action="{:U('Admin/Finance/imports_excel2')}"  enctype="multipart/form-data"  method="post"  class="layui-form" id="imports_excel" style="display:none;">
<div class="layui-form">
    <table class="layui-table">
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>选择文件：</td>
	  <td width="80%">
      <span class="table_span" style="width:90%; float:left;"><input name="exl" type="file" id="exl" value="" lay-verify="" placeholder="" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr> 
	  <td colspan=2 align="center" valign="middle">
		<input type="submit" name="Submit" value="确&nbsp; &nbsp;定" class="layui-btn" >
		<input type="reset" name="Submit2" value="重　置" class="layui-btn layui-btn-primary" >		 </td>
	</tr>
    </table>
</div>
</form>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script>
//Demo
layui.use(['form','laydate'], function(){
 var form = layui.form
  ,laydate = layui.laydate;
   var active = {
       notice: function(){
		  layer.open({
			type: 1
			,title: '新增网站续费' //不显示标题栏
			,closeBtn: 2
			,area: ['680px','550px']
			,shade: 0.4
			,id: 'LAY_layuipro' //设定一个id，防止重复弹出
			//,btn: ['提交', '关闭']
			,btnAlign: 'c'
			,moveType: 1 //拖拽模式，0或者1
			,content: $("#renewal_add"),
            })
       }
	   
	   ,imports: function(){
		  layer.open({
			type: 1
			,title: '导入Excel' //不显示标题栏
			,closeBtn: 2
			,area: ['600px','200px']
			,shade: 0.4
			,id: 'LAY_imports' //设定一个id，防止重复弹出
			//,btn: ['提交', '关闭']
			,btnAlign: 'c'
			,moveType: 1 //拖拽模式，0或者1
			,content: $("#imports_excel"),
            })
       }
	   
   }
   
    $('.layui-btn-group .layui-btn').on('click', function(){
		var othis = $(this), method = othis.data('method');
		active[method] ? active[method].call(this, othis) : '';
	  });
  
  //监听提交
  form.on('submit(btnDel)', function(data){
    //layer.msg(JSON.stringify(data.field));
	title: '最终的提交信息'
	return true;
  });
  
  laydate.render({
    elem: '#inputtime'
	,type: 'datetime'
  });
  laydate.render({
    elem: '#paytime'
	,type: 'date'
  });
   laydate.render({
    elem: '#start'
	,type: 'date'
  });
  laydate.render({
    elem: '#end'
	,type: 'date'
  });
    /*计算总和*/
  $num = 0;
  $("#table").find("tr").find("#income").each(function(index, p){
      if($(this).html() != ""){
	      $num = $num + Number($(this).html());
		  console.log(Number($(this).html()));
	  }
  })
  $("#income2").html("<font color='#009688'> ￥" + $num + "</font>");

  $(document).keyup(function(event){ 
      if(event.keyCode ==13){  
	      $("#search").trigger("click"); 
      }
  });
 
});
</script>
